Converter for binary and binary-coded decimal numbers



April 7 l197() l T. o.- HoLTEY CONVERTER FOR BINARY AND lBINAHYCODED DECIMAL NUMBERS Filed July 21. 196e 2 Sheets-Sheet 1 5&3@ Saz. Y 25 S NN wm m23@ oo.

modomo mQOO ,556mm tm w CONVERTER Fon BINARYQAND BINARY-VCODED DECIMAL NUMBERS Filed July 21. 19566 April 7, 1970 I 2 Sheets-Sheet 2 INVENTOR.

THOMAS O. HOLTEY Rows i 3,505,675 Patented Apr. 7, 1970 United States Patent Othce 3,505,675 CONVERTER FOR BINARY AND BINARY-CODED DECIMAL NUMBERS Thomas O. Holtey, Newton Lower Falls, Mass., assignor to Honeywell Inc., Minneapolis, Minn., a corporation of Delaware Filed July 21, 1966, Ser. No. 566,890 Int. Cl. G08c 9/00, 11/00 U.S. Cl. 340-347 10 Claims ABSTRACT OF THE DISCLOSURE This invention relates to radix conversion and more particularly to improved method and apparatus lfor converting numbers between binary and binary coded decimal expressions.

The transformation between binary and binary coded decimal notation has been accomplished in the past using two clock periods per binary digit (cf. Couleur, IRE Transactions on Electronic Computers, pp. 313-316, December 1958, and U.S. Patent No. 3,026,034). While it has been suggested that operation at one clock period per binary digit could be accomplished, the straightforward combination of the test and shift steps proposed in the prior art require increased complexity in the logic i and control circuits. Such arrangements not only increase the cost factor for any given machine size but, more importantly, require the cascade .operation of several logic units for performing the various functions with the result that the operating speed of the conversion can be no faster than the slowest time for such cascades. Where fast The present invention performs the desired conversions by making use of either multiply or divide by two algorithms which show the basis for the required operations, Essentially the decimal to binary conversion consists of dividing the decimal number by two and storing the remainders after each step to form the binary result. The coded decimal digits appear in n identical decade registers (0 to n-l inclusive) and the process of division requires only a -knowledge of the contents of a register and the condition of the next higher decade register, i.e. Whether the number therein is odd or even. The conversion that takes place each clock period in each decade register is therefore given in Table I where the present digit, dki, is the k-th digit for the -th clock period which is divided by two to obtain the next digit dkii'l for the (z'|-1)-th clock period in dependence on whether the content of machine operating cycles are required, such as 18 mc. for

example, the cascaded logic steps must be held to a minimum.

The present invention provides the desired `conversions between binary and binary coded decimal expressions by conversion algorithms implemented in such manner that each digit of the conversion requires only a determination ofthe present contents of the digit register and a single input from its immediate neighbor. The speed with which either conversion can be performed with this arrangement is further enhanced by utilizing an optimized coding for the secondary lstate assignments during the conversion. This coding also provides a basis for common structural elements in each conversion so that binary to binary coded decimal and binary coded decimal to binary conversions can be accomplished with the same apparatus utilizing additional control logic and appropriate switching of the input and output.

It is accordingly the principal object of the present invention to provide improved method and apparatus for radix conversion having the foregoing features and advantages. Other objects and advantages will become apparent from the following detailed description taken in conjunction with the accompanying drawings wherein:

FIG. 1 is a diagram of apparatus for n digit m bit conversions between binary and binary coded decimal representations; and

FIG. 2 is a diagram of the digit registers and cornbinatorial logic as employed in the decades of FIG. 1.

the next higher decade ('k-l-l) is odd or even before the conversion occurs. This later condition is ,given by Xk+1i=1 if and only if the the content of the k+1 decade is odd. The result, dkiJfl, is thus either the quotient of division by 2 or the quotient plus five as shown:

TABLE L-DECIMAL TO BINARY (DIVIDE BY 2) The binary to decimal conversion consists of summing the powers of two multiplied by the binary digit for that power. In terms of the n decade registers, if the binary number is entered most significant bit rst into the lowest or zero decade and the contents of all decades are multiplied by two each clock period the result after m clock periods will be correct if each register supplies the next higher order register with an input determined by whether the registers own contents are equal to or greater than live prior to the multiplication. The conversion that takes place each clock period in each register is therefore given in Table II where the present digit, dki, is the k-th digit for the -th clock period which is converted to the next digit dk1+1 for the (i|1)th clock period in dependence on whether the content of the next lower decade (k-l) is equal to or greater than ve before the conversion occurs. This later condition is given by Yk 1i=1 if and only if the content of the (k-l) decade is equal to or greater than ve. The result, dkb, is thus either the product of multiplication 'by 2 or the product plus one as shown:

Present Digit dki ` Referring now to FIG. 1 the complete conversion apparatus is shown comprising n decades to nJ-l inclusive each having a six bit register 21 operating with a combinatorial logic unit 22. The (n1)th decade has an input converter 23 for converting the binary coded decimal input to the minimal code used in the registers 21 as hereinafter described. Similarly the zero decade has a converter 24 for converting the minimal code in the registers 2.1 into binary coded decimal output. The zero decade is connected to an m| bit binary register 2-5 which has a binary input 26 and binary output 27.

Each decade receives a Y signal from the next lower order decade with the Y signal for the zero decade being the m bit binary number shifted serially from the binary register 25 most significant bit rst.

Each decade receives an X signal from the next higher decade with the X signal for the n'1 decade being a binary zero.

In operation for binary to decimal conversion an m bit binary number is entered on input 26 to the binary register 25 and shifted out one bit per clock interval to the logic unit 22 of the Zero decade. After m1 clock intervals the coded decimal number in the decade registers 21 can be read out as a binary coded decimal number from output 28 of converter 24.

The operation for decimal to binary conversion enters a binary coded decimal number at input 29 into the converter 2.3 which stores the code representation in the decades 21. The transfer of the digits can be by serial or parallel transfer as indicated by transfer paths 31. The X signal from the zero decade is shifted serially into the binary register 25 and after m clock operations the binary number in the register is the desired result. This binary number may be extracted from the output 27 as desired.

The present invention can perform the same conversion algorithms indicated in Tables I and II employing binary coded decimal representaiton in the decade registers but the cascaded logic switching times required would preclude the highest operating speeds and require a greater amount of equipment than a more optimum code. In accordance with the preferred embodiment of the invention an optimal code for the decade registers is employed which minimizes the equipment required and reduces the cascaded operating times to no greater than three thus permitting 8 mc. clock frequencies with state of the art logic components.

Referring now to FIG. 2, the details of the registers 21 and the combinatorial logic units 22 for each decade in FIG. l will be described. Each register 21 contains six delay flip llops FFA, FF-B, FFC, FFD, FFE and FFF each of which has a logic input 41 and a clock input 42. The flip flops each respond at the clock time input on line 42 to assert the logic input on line 41 as an assertion output and a negation output. For example,A FFA produces on line A the assertion of the signal on line 41 andthe on line 42 occurs. v

The input signals to the ip -ilops on lines 41 are o'btained from signals designated A', B', C', D',- E and F' respectively which are controlled throughv ANDs 43 in accordance with control signals BTD and DTB. When the conversion is binary to decimal the signal BTDl enables ANDs 43 for Hip flops FFE and FFF. When the conver sion is decimal to binary the signal DTB enables ANDs 43 for ip flop FFB and FFC. The ANDs 43 for flip ops FFA and FFD are enabled for both signals as represented by the equation CVT=B'TD+DTB.

The logic for producing the A', B', C', D', E' and F' signals is shown in FIG. 2. The source of the signals Xki, Y1.:i and Yk-i which are passed to adjacent stages is also shown. For clarity the interconnections are not shown but are indicated by the letter notation .in which all signals are internal to a particular decade except the X and Y from adjacent decades and the common control signals DTB and vIBTD. As previously stated the Y signals for the 4 v 10 decade is the m` bit binary number shifted most signifcant bit iirst from the binary register 25 'of FIG. 1 and the X signal for the 10H-1 decade is a binary zero at all times.

The logic for FIG. 2 is obtained from the state assignment codes, Kanaugh maps and logic statements for the two operations as follows:

Decimal to Binary Conversion STATE ASSIGNMENT-CODE FEDCBA KANAU GH MAP Binary to Decimal Conversion STATE ASSIGNMENT-Coon FEDCBA 000000 0 10-000 1 2010000 371-000 1 4 10000 0 4500100 1 ego- 0 701100 1 s 1-100 0 010100 1 6 KAN'AUGH M A'P where again 1, 2, 3 and 4 represent the l, 2, 4 and 8 weight D A flip ops of the binary coded decimal digits. KANAUGH MAP 00, 01 11 i0 D,A

` `0110000101010 0100' F,E Y=0 000000000101010110 00 01 -ii i0 4, 3, 2, 1 v r LOGIC STATEMENTS 00 *011- 010- 1- 01 I A EL; 01 0 -1 1 1 0 1 0 0 .i 0 1 Y=1 Z= F+A D +A F+ 11 0 1 1 if- 0'1 i i 3=D.F+.j.p

F,-E, D, A, Againi 1these logic equtlionsdare implemezxted by Cconf ventiona ogic circuits in eco econverter to pro uce LOGIC STATEMENTS the signals l, 3 and 4 for the 1, 2, 4 and 8 weight ip A'gy 25 ops of the binary coded decimal output on line Z8 in .B'=' accordance with the aforementioned state assignment C'= code for binary to decimal conversion. D: F+Y. E E From the foreg0ing it will be appreciated that the in- E;= A B y vention provides circuits many of which are common to F, KEF both conversions and which minimize both the equipment v and operating time required. While the functions of mul- Y :D tiplying or dividing by two and conditioning the result on the state of an adjacent decade could be performed with v other code representations in the decades and thus achieve CODE CONVERTERS 35 the desired results, the preferred coding of the disclosed v embodiment has aspects which simplify the circuits and The mpuf conversion/mt 23 which 1s requlfed to con' enhance the operating speed. In particular the coding for Ver? the offlinary 8 4 25 1 we lght stiigs of a bfnary coded decimal to binary conversion has identical assignments decimal digit to the codeV utilized 1n the registers Z1 of for 0 4 and 5 9 except of the D bit The present Content FIGS' 1 am? 2 1S gwen a? follows Where 1 2 3 and 4 fep 40 of a decade affects only flip flops FFA, FFB and FFC misent the lp 'flops associate@ .with the .1 2 4 and' 8 Weight and the incoming X signal affects only PFD. The D signal bus of each bmary coded fhg m the Input 29- thus acts as a ive weight bit. For binary to decimal i conversions the code assignments again are the same for 0-4 and 5-9 except for complementation of A, and D is KANAUGH MAP 45 again a five weight bit. Thus the X and Y signals for adl 2, i.- jacent decades are derived from the D bit without scanning the stages of the entire decade. 00 01 i1 Many modifications will occur to those skilled in the art for practicing the invention in various forms. For ex- ;005 1 40 1 .0 1 0`- 1` f 1 0 0 50 ample the conversion of negative quantities can be ac- .O l 1 `1- 1 o' o l 01 0 0 l complished using twos complement arithmetic. For a bi- 3 nary to decimal conversion the twos complement is taken 11 1 .0.- l 0 1 0 1 0 0 1 0 of the input quantity entered at input 29; for decimal to .i0 051; 1 021 .1 0 binary conversions the twos complement is taken of the bits shifted into binary register 25 from the zero decade D, o, B,A register 21. Various methods for handling the binary and LOGIC STATEMENTS decimal points can be used to extend the capacity to num- "f bers in excess of the register capacity. Also serial and A=1--JQ-i-'1'--4-p-2-3t parallel shift in and out of registers is possible. Finally, 5:2.; 60 the particular logic functions can be performed by devices 4+ 2,3;l ,3; other than those specified. For example, the term flip-flop D`=+3 4+ 3 1s to be understood as covering any suitable bistable de- E=01 vice. The invention accordingly is to be interpreted as not F=0 limited to the specific disclosure but only by the scope of the appended claims.

Theselogic equations are implemented by conventional logic circuits in the code converter'23- to produce'the signals A, C, D, E and F for the ipops of registers 21 70".' comprising the steps of: in accordance with the aforementioned-stateassignment code for decimal to binary conversion.

The output conversion unit 2 4 which is required to convert the coded representation in the registers 21 into binary coded decimal output on line 2811s given as follows I claim:

1. The method of single clock period conversion of an m bit binary number into the binary coded decimal representation of the corresponding n digit decimal number (a) entering the binary number in binary storage;

(b) shifting the binary number most significant bit rst to a series of n decades coded to represent decimal digits the code in each decade characterized by a ve Weight bit;

n digit binary coded decimal number into corresponding m bit binary number comprising the steps of (a) entering a representation of said n digit binary coded decimal number in n coded decades the code in each decade characterized by a tive weight bit;

(b) dividing the coded representation in each said decn ade by two to obtain a quotient and remainder;

(c) adding five to each next lower decade whenever said remainder is odd as determined by said iive weight bit;

(d) shifting the binary remainder from the lowest decade into serial storage least significant bit first;

(e) repeating each clock period the division by two and shifting steps of (b), (c) and (d); and,

(f) extracting the m bit binary number from storage after m clock periods.

3. Apparatus for converting an m bit binary number to n digit binary coded decimal with a single clock period per binary bit comprising:

(a) an m bit binary register for storing said binary number, said register shiftable to transfer said binary number serially most significant bit first;

(b) n decade registers for receiving said binary number and storing coded representations of the digits of said decimal number, said registers operating to multiply the decimal number therein by two each clock period and, if the number in the next lower stage equalled or exceeded five before each multiplying cycle, add a one; and,

(c) means for extracting from said n decade registers the binary coded decimal representation of said number after m clock periods, said decade registers containing a coded representation of the digits of said decimal number therein such that each decade includes a ilip op stage the state of which represents a iive Weight bit, said flip-flop stage in each decade coupled to the next higher decade for adding said one when the number in said each decade is iive or greater; said means for extracting including converting means for converting said coded representation into a binary coded decimal representation of said number.

4. Apparatus according to claim 3 in which said coded representation of the digits of said decimal number includes a flip ilop stage in each decade the state of which represents a five weight bit and said ip flop stage in each decade is coupled to the next higher decade for adding said one when the number in said each decade is ve or greater; and said means for extracting includes converting means for converting said coded representation into a binary coded decimal representation of said number.

5. Apparatus for converting an n digit binary coded decimal number to m bit binary with a single clock period per binary bit comprising:

(a) n decade registers;

(b) means for entering an n digit coded representation of said binary coded decimal number in the decades of said n decade register;

(c) means for dividing the coded representation in each of said decades by two for each clock cycle; and adding five if the remainder from the next higher stage is odd prior to each division; and

(d) an m bit binary register for receiving and storing the remainder from the lowest lorder decade register,

said means forentering including conversion means for converting said binary coded decimal number into said coded representation, saidcoded representation of the digits of said decimal number including a register in each decade having a ilip flop stage the state of which represents a ve weight bit and said iip op stage in each decade is coupled to the next higher decade for receiving a binary one when the number in said higher decade is odd thereby representing the addition of a iive to said each decade.

6. Apparatus according to claim 5 in which said means for entering includes conversion means for converting said binary coded decimal number into said coded representation, said coded representation of the digits of said decimal number including a ip op stage in each decade the state of which represents a five weight bit and said iiip op stage in each decade is coupled to the next higher decade for receiving a binary one when the number in said higher decade is odd thereby representing the addition of a five to said each decade.

7. Apparatus for converting an m` bit binary number to an n digit binary coded decimal with a single clock period per binary bit comprising: l

(a) an m bit binary register for storing said binary number, said register shiftable to transfer said binary number serially most signiiicant bit iirst;

(b) n decade registers each comprising ip flop stages A, D, E and F; p (c) control logic for each of said decade registers typitied by the k-th decade for the z'th clock period corresponding to Allei Yii-r Dr=Fki-IYi1-Ek-Ek E'ki=k-DklAIkDk F'k=Fr-Ek-l Yi-1Fk-Eki-l-Yi-rEki-Ek Yki=Dki where the i+1 state of the ilip ilops is determined by the z'th state of the primed variable; and k varies from 0 to n-l with Yk-r defined as equal to binary one if the value in the k-l decade for the i-th clock operation is equal to or greater than ve and equal to binary zero if the value is less than ve and Yi-r for the lowest order decade register is the binary shifted output of said binary register; and (d) conversion means operable after m clock periods to produce a binary coded decimal loutput represented in four stages 1, 2, 3 and 4 per digit from the ips ops in said decades corresponding to (c) control logic for each of said decade registers typified by the k-th decade for the i-th clock period corresponding to by the -th state of the primed variables and k varies from to n-l with dened as equal to binary one if the value in lthe k+1 l decade for the i-th clock operation is odd and a binary zero if the value is even and is binary zero for all i; and

(d) an m bit binary register for recovering and storing the binary number obtained as the output. 9. The combination for converting numbers betwee binary and binary coded decimal representations com prising:

(a) a binary to binary coded decimal converter including apparatus for converting an m bit binary number to an n digit binary coded decimal'with a single clock period per binary bit comprising:

(i) an m bit binary register for storing said binary number serially most significant bit first; (ii) n decade registers each comprising ilip flop stages A, D, E and F; (iii) control logic for each of said decade registers typified by the k-th decade for the i-th clock period corresponding to Aki= Yl-l D'k=Fki-i Yi-r'Eki-ETQ E'ki=A kiDki+lki- F'ki=Fki-Ekf+YL1-E'k+Yi 1-Eki- Yki=Dki where the i-l-l state of the ilip flops is determined by the z'th state of the primed variables; and k varies from 0 to n-l with Yki delined as equal to binary one if the value in the k-l decade for the -th clock operation is equal to or greater than ve and equal to binary zero if the value is less than live, and

Yi-1 for the lowest order decade register is the binary shifted output of said binary register; and (iv) conversion means operable after m clock periods to produce a binary coded decimal output represented in four stages l, 2, 3 and 4 per digit from the llip ops in said decades corresponding to 2=F|AD-E|A-F+ZE 3 =D.F .17.F 4=D'F (b) a binary coded decimal to binary converter including apparatus for conveterting an n digit binary coded decimal number to m bit binary with a single clock period per binary bit comprising:

(i) n decade registers each comprising flip flops A, B, C and D;

(ii) converting means for changing said n digit `binary coded decimal number represented in four stages 1, 2, 3 and 4 per digit into an n digit coded representation in said flip ops A, B, C and D for each digit corresponding to (iii) control logic for each of said decade registers typified by the k-th decade for the i-th clock period corresponding to where the -I-l state of the ilip flops is determined by the -th stage of the primed variables; and k varies from 0 to n-l with del'ined as equal to binary one if the value of the k-i-l decade for the z'th clock operation is odd and a binary zero if the value is even and in binary zero for all z'; and, (iv) an m bit binary register for receiving and storing the binary number obtained as the output, the n decade registers for each said converter being the same n registers of six flip ops each, A, B, C, D, E and F; and (c) additional control logic selectively operable to disable flip ops vB and C for binary to binary coded decimal conversions and to disable flip flops E and F for binary coded decimal to binary conversions. 10. The combination according to claim 9 in which the same m bit binary register is connected to be common to both conversions for respectively receiving the binary number input or supplying the binary number output.

References Cited UNITED STATES PATENTS 3,026,034 3/1962 Couleur 23S-154 3,026,035 3/ 1962 Couleur 23S-154 3,032,266 5/ 1962 Couleur 23S-154 3,064,894 11/1962 Campbell 235-155 MAYNARD R. WILBUR, Primary Examiner I. GLASSMAN, Assistant Examiner U.S. Cl. X.R. 23S-154, 155 

